﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BackgroundAxis : MonoBehaviour
{
    public Transform player_trans;

    public float axisX = 0.5f;
    public float axisY = 1f;

    private float startPositionX, startPositionY;

    public bool lockY = false;

    // Start is called before the first frame update
    void Start()
    {
        startPositionX = transform.position.x;
        startPositionY = transform.position.y;
    }

    // Update is called once per frame
    void Update()
    {
        if(lockY)
        {
            gameObject.transform.position = new Vector3(startPositionX + player_trans.position.x * axisX, transform.position.y);
        }
        else
        {
            gameObject.transform.position = new Vector3(startPositionX + player_trans.position.x * axisX, startPositionY + player_trans.position.y * axisY);
        }
    }
}
